﻿@model SCMS.UI.Models.AddTAnalysis
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "TADetailsDiv",
      LoadingElementId = "loading",
      HttpMethod = "Post",
      Url = Url.Action("AddSupplier/" + ViewBag.TAID),
      OnSuccess = "CancelPopup"
  };}
<h2 class="gridheader">
    New Supplier</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
{
    @Html.ValidationSummary(true)
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td align="left">
                Supplier/Company
            </td>
            <td align="left">
                @Html.DropDownListFor(x => x.EntityTenderBidder.SupplierId, Model.Suppliers, "- please select -")
            </td>
        </tr>
        <tr>
            <td align="left">
                Shipping Term
            </td>
            <td align="left">
                @Html.DropDownListFor(x => x.EntityTenderBidder.ShippingTermId, Model.ShippingTerms, "- please select -")
            </td>
        </tr>
        <tr>
            <td align="left">
                Terms of Payment
            </td>
            <td align="left">
                @Html.DropDownListFor(x => x.EntityTenderBidder.PaymentTermId, Model.TermzOfPayments, "- please select -")
            </td>
        </tr>
        @for (int i = 0; i < Model.RequestItems.Count; i++)
        {
            <tr>
                <td align="left">
                    @Html.DisplayFor(s => Model.RequestItems[i].ItemDescription)
                </td>
                <td align="left">
                    @Html.EditorFor(s => Model.RequestItems[i].UnitCost)<br />
                    @Html.ValidationMessageFor(s => Model.RequestItems[i].UnitCost)
                </td>
            </tr>
            @Html.HiddenFor(s => Model.RequestItems[i].EntityRequestedItem.Id)
        }
        <tr>
            <td align="left">
                Transport Cost
            </td>
            <td align="left">
                @Html.EditorFor(model => model.EntityTenderBidder.TransportCost)<br />
                @Html.ValidationMessageFor(model => model.EntityTenderBidder.TransportCost)
            </td>
        </tr>
        <tr>
            <td align="left">
                Total Cost
            </td>
            <td align="left">
                @Html.EditorFor(model => model.EntityTenderBidder.TotalCost)<br />
                @Html.ValidationMessageFor(model => model.EntityTenderBidder.TotalCost)
            </td>
        </tr>
        <tr>
            <td align="left">
                Delivery Time
            </td>
            <td align="left">
                @Html.EditorFor(model => model.EntityTenderBidder.DeliveryTime)<br />
                @Html.ValidationMessageFor(model => model.EntityTenderBidder.DeliveryTime)
            </td>
        </tr>
        <tr>
            <td align="left">
                Warranty
            </td>
            <td align="left">
                @Html.EditorFor(model => model.EntityTenderBidder.Warranty)<br />
                @Html.ValidationMessageFor(model => model.EntityTenderBidder.Warranty)
            </td>
        </tr>
        <tr>
            <td align="left">
                Others
            </td>
            <td align="left">
                @Html.EditorFor(model => model.EntityTenderBidder.Comments)<br />
                @Html.ValidationMessageFor(model => model.EntityTenderBidder.Comments)
            </td>
        </tr>
    </table>
    <p>
        <input type="submit" class="btn green"  value="Add Supplier" />&nbsp;
        <input type="button" value="Cancel" onclick="javascript:CancelPopup()" />
    </p>
}
